<template>
	<view class="contanier">
		<view class="shopInfo" v-if="post">
			<uniIcons type="shop"></uniIcons>
			<text>{{post.shopName}}</text>
		</view>
		<view class="head" v-if="post">
			<image :src="post.img" class="goodsPic" mode="aspectFit"></image>
			<view class="goodsDesc">
				{{post.goodsName}}
			</view>
		</view>
		<block v-if="goodsComment">
			<commentDetail :comment="goodsComment"></commentDetail>
		</block>
	</view>
</template>

<script>
	import uniIcons from "@/components/uni-icons/uni-icons.vue"
	import commentDetail from "@/components/commentDetail/commentDetail.vue"
	import empty from "@/components/empty.vue"
	export default {
		components: {
			uniIcons,
			commentDetail,
			empty
		},
		data() {
			return {
				post: null,
				goodsComment: null
			}
		},
		onLoad(options) {
			this.post = JSON.parse(options.param)
			this.loadComment()
		},
		methods: {
			loadComment() {
				let that = this
				let {
					goodsId,
					specId,
					orderId,
					orderGoodsId
				} = that.post
				that.$Request.request('/api/Goodsappraises/getAppr', 'POST', {
					goodsId,
					specId,
					orderId,
					orderGoodsId
				}).then(res => {
					if (res.status == 1) {
						let data = res.data
						that.goodsComment = {
							goodsRate: data.goodsScore,
							serviceRate: data.serviceScore,
							expressRate: data.timeScore,
							commetnText: data.content,
							imgs: data.images
						}
					}

				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss">
	@import './showComment.scss'
</style>
